package com.restkeeper.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;

@Getter
@AllArgsConstructor
public enum WXTemplateIdEum {

    /**
     * 报警通知
     * */
    POLICE("alarm", "zybpTVhlRpdfPMPODZUlw1f9WV0GXWf1IxuJE6xIllc"),
    /**
     * 充值成功提醒
     * */
    rechaarge_balance("rechaarge_balance", "lQjoMKIawG-UC32i4s4mYPzbCgpB5HgMqn9Kr5GG-4Q"),
    /**
     * 续费成功通知
     * */
//    rechaarge_annual("rechaarge_annual", "8A7UdO1HpMZfKUBh7ZR_7GpGFhadtXHMRtmdzJFQcCY"),
    rechaarge_annual("rechaarge_annual", "8A7UdO1HpMZfKUBh7ZR_7DZpsH8epVFxx_3fDxLnN9g"),

    ;



    public String name;
    public String code;

    public static String getNameByCode(Integer code) {
        if(code==null)
            return null;
        for (WXTemplateIdEum incomeTypeEnum : WXTemplateIdEum.values()) {
            if (incomeTypeEnum.code.equals(code)) {
                return incomeTypeEnum.name;
            }
        }
        return code.toString();
    }

    public static String getCodeByName(String name) {
        if(StringUtils.isBlank(name))
            return null;
        for (WXTemplateIdEum incomeTypeEnum : WXTemplateIdEum.values()) {
            if (incomeTypeEnum.name.equals(name)) {
                return incomeTypeEnum.code;
            }
        }
        return null;
    }


}
